package com.ruoyi.tws.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.tws.domain.TwsCompany;
import com.ruoyi.tws.third.AliOcrService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/third")
public class ThirdController extends BaseController {

    private final AliOcrService aliOcrService;

    /**
     * 阿里云 - 营业执照识别
     */
    @PostMapping("/ocr-business-license")
    public AjaxResult ocrBusinessLicense(@RequestBody String url) {
        TwsCompany company = aliOcrService.ocrBusinessLicense(url);
        if (company == null){
            company = new TwsCompany();
        }
        return AjaxResult.success(company);
    }

}
